package cn.faifai.desktop.view.components.treeDirectory;

import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class DirectoryBrowser extends VBox {
    @Autowired
    private FileBrowser fileBrowser;
    @Autowired
    private TagBrowser tagBrowser;


    public DirectoryBrowser initUI() {
        fileBrowser.initUI();
        tagBrowser.initUI();
        TabPane tabPane = new TabPane();
        Tab fileTab = new Tab("文件目录", fileBrowser);
        Tab tagTab = new Tab("标签目录", tagBrowser);
        fileTab.setClosable(false);
        tagTab.setClosable(false);
        tabPane.getTabs().addAll(fileTab, tagTab);
        this.getChildren().add(tabPane);
        VBox.setVgrow(tabPane, Priority.ALWAYS);
        VBox.setVgrow(fileBrowser, Priority.ALWAYS);
        return this;
    }
}
